import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { AdminLogVO, AdminLogForm, AdminLogQuery } from '@/leadmall/api/adminLog/types';

/**
 * 查询员工操作日志列表
 * @param query
 * @returns {*}
 */

export const listAdminLog = (query?: AdminLogQuery): AxiosPromise<AdminLogVO[]> => {
  return request({
    url: PORT +'/leadmall/adminLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工操作日志详细
 * @param id
 */
export const getAdminLog = (id: string | number): AxiosPromise<AdminLogVO> => {
  return request({
    url: PORT +'/leadmall/adminLog/' + id,
    method: 'get'
  });
};

/**
 * 新增员工操作日志
 * @param data
 */
export const addAdminLog = (data: AdminLogForm) => {
  return request({
    url: PORT +'/leadmall/adminLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工操作日志
 * @param data
 */
export const updateAdminLog = (data: AdminLogForm) => {
  return request({
    url: PORT +'/leadmall/adminLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工操作日志
 * @param id
 */
export const delAdminLog = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/adminLog/' + id,
    method: 'delete'
  });
};
